#include <stdio.h>

int main() {
    int N;
    int count[10] = {0}; int num;

    scanf("%d", &N);

    for (int i = 0; i < N; i++) {
        scanf("%d", &num);
        if (num == 0) {
            count[0]++;
        }
        while (num > 0) {
            int digit = num % 10;
            count[digit]++;
            num /= 10;
        }
    }

    int maxCount = 0;
    for (int i = 0; i < 10; i++) {
        if (count[i] > maxCount) {
            maxCount = count[i];
        }
    }

    printf("%d:", maxCount);
    for (int i = 0; i < 10; i++) {
        if (count[i] == maxCount) {
            printf(" %d", i);
        }
    }

    return 0;
}
